package com.games.game.service;

import com.games.game.bean.UserInfo;
import com.games.game.mapper.UserMapper;
import org.springframework.stereotype.Service;

@Service
public class User_ServiceImp implements User_Service {
    private UserMapper userMapper;

    public User_ServiceImp() {
        this.userMapper = new UserMapper();
    }

    public UserInfo logIn(String name, String password) {
        return userMapper.logIn(name, password);
    }

    public boolean register(String name, String password) {
        UserInfo userInfo = this.userMapper.logIn(name, password);
        if (userInfo != null) {
            return false;
        }
        userMapper.register(name, password);
        return true;
    }

    public void modify_password(String name, String n_password) {
        userMapper.modify_password(name, n_password);
    }

    public void update_photo(String username, String photo) {
        userMapper.update_photo(username, photo);
    }


}
